package com.rentong.cust.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.rentong.common.annotation.Log;
import com.rentong.common.core.controller.BaseController;
import com.rentong.common.core.domain.AjaxResult;
import com.rentong.common.enums.BusinessType;
import com.rentong.cust.domain.subscriberV1;
import com.rentong.cust.service.IsubscriberV1Service;
import com.rentong.common.utils.poi.ExcelUtil;
import com.rentong.common.core.page.TableDataInfo;

/**
 * 用户管理Controller
 * 
 * @author ruoyi
 * @date 2025-01-09
 */
@RestController
@RequestMapping("/subscriberV1/subscriberV1")
public class subscriberV1Controller extends BaseController
{
    @Autowired
    private IsubscriberV1Service subscriberV1Service;

    /**
     * 查询用户管理列表
     */
    //('subscriberV1:subscriberV1:list')")
    @GetMapping("/list")
    public TableDataInfo list(subscriberV1 subscriberV1)
    {
        startPage();
        List<subscriberV1> list = subscriberV1Service.selectsubscriberV1List(subscriberV1);
        return getDataTable(list);
    }

    /**
     * 导出用户管理列表
     */
    //('subscriberV1:subscriberV1:export')")
    @Log(title = "用户管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, subscriberV1 subscriberV1)
    {
        List<subscriberV1> list = subscriberV1Service.selectsubscriberV1List(subscriberV1);
        ExcelUtil<subscriberV1> util = new ExcelUtil<subscriberV1>(subscriberV1.class);
        util.exportExcel(response, list, "用户管理数据");
    }

    /**
     * 获取用户管理详细信息
     */
    //('subscriberV1:subscriberV1:query')")
    @GetMapping(value = "/{custId}")
    public AjaxResult getInfo(@PathVariable("custId") Long custId)
    {
        return success(subscriberV1Service.selectsubscriberV1ByCustId(custId));
    }

    /**
     * 新增用户管理
     */
    //('subscriberV1:subscriberV1:add')")
    @Log(title = "用户管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody subscriberV1 subscriberV1)
    {
        return toAjax(subscriberV1Service.insertsubscriberV1(subscriberV1));
    }

    /**
     * 修改用户管理
     */
    //('subscriberV1:subscriberV1:edit')")
    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody subscriberV1 subscriberV1)
    {
        return toAjax(subscriberV1Service.updatesubscriberV1(subscriberV1));
    }

    /**
     * 删除用户管理
     */
    //('subscriberV1:subscriberV1:remove')")
    @Log(title = "用户管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{custIds}")
    public AjaxResult remove(@PathVariable Long[] custIds)
    {
        return toAjax(subscriberV1Service.deletesubscriberV1ByCustIds(custIds));
    }
}
